import re

if __name__ == '__main__':
    text = 'abbaaabbbbaaaaa'
    pattern = 'ab'
    for match in re.finditer(pattern, text):
        # print(type(match))
        s = match.start()
        e = match.end()
        print('Found {!r} at {:d}:{:d}'.format(text[s:e], s, e))
